package ThreadTest;

class MySleepThread implements  Runnable{
    @Override
    public void run() {
        for (int i=0;i<10;i++){
            System.out.println(Thread.currentThread().getName()+"运行，i="+i);
            try {

                Thread.sleep(3000);

            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}


public class SleepThread {
    public static void main(String[] args) {
        MySleepThread my= new MySleepThread();

        new Thread(my,"自定义线程").start();
        my.run();// main 线程
    }
}
